package com.szcf.testserial.utils;

/**
 * 命令集
 * @author bill
 *
 */
public class Command {

	// 报警开关 FF0900F00A00FE
	public static String sendCommandWarringPower(boolean power) {
		if (power == true) {
			return CRC16.hexVerification("FF09"+Constants.COMMAND_ADDRESS_MACHINE+"F00A00")+"FE";
		} else {
			return CRC16.hexVerification("FF09"+Constants.COMMAND_ADDRESS_MACHINE+"F00F00")+"FE";
		}
	}
	
	// 出货命令 FF0C00A30B01010103E3AEFE
	public static String sendCommandGoods(String channelY, String channelX,  String turn ) {
		return CRC16.hexVerification("FF0C"+Constants.COMMAND_ADDRESS_HEIGHT+"A30B"+channelY+channelX+turn+"03")+"FE";
	}
	
	// 格子锁出货命令 FF0C00A30B01010103E3AEFE
	public static String sendCommandLattices(String channelY, String channelX) {
		return CRC16.hexVerification("FF0A"+Constants.COMMAND_ADDRESS_MACHINE+"A20B"+channelY+channelX)+"FE";
	}
	
	// 履带机-开关出货命令 FF0C00A30B01010103E3AEFE
	public static String sendCommandPedrailPower(String channelY, String channelX, String value) {
		return CRC16.hexVerification("FF0C"+Constants.COMMAND_ADDRESS_MACHINE+"A40B"+channelY+channelX+value+"03")+"FE";
	}
	
	// 升降机命令 ff 0c 00 d5 0a 00 12 00 00 64 90 fe
	public static String sendCommandHeight(String height) {
		return CRC16.hexVerification("FF0C"+Constants.COMMAND_ADDRESS_HEIGHT+"D50A00"+height+"0000")+"FE";
	}
	
	// 升降机命令 ff 0c 00 d5 0a 00 12 00 00 64 90 fe
	public static String sendCommandHeight2(String y, String x) {
		return CRC16.hexVerification("FF0D"+Constants.COMMAND_ADDRESS_HEIGHT+"D500"+y+"00"+x+"0000")+"FE";
	}
	
	// 升降机xy复位命令 ff 0c 00 d5 0a 00 12 00 00 64 90 fe
	public static String sendCommandHeight2Reset() {
		return "FF0D"+Constants.COMMAND_ADDRESS_HEIGHT+"D500000000000099A9FE";
	}
	
	// 输送带命令 ff 0c 00 d5 0a 00 12 00 00 64 90 fe
	public static String sendCommandSendout2(String occlusion, String sendOut) {
		return CRC16.hexVerification("FF0A"+Constants.COMMAND_ADDRESS_HEIGHT+"D80A"+occlusion+sendOut)+"FE";
	}
	
	// 自动开门命令 FF0B00D10B000B004CC9FE
	public static String sendCommandDoorOpen() {
		return CRC16.hexVerification("FF09"+Constants.COMMAND_ADDRESS_HEIGHT+"D1"+Constants.COMMAND_DOOR_STATUS_OPEN+"00")+"FE";
	}
	
	// 自动关门命令 FF0B00D10B000B004CC9FE
	public static String sendCommandDoorClose() {
		return CRC16.hexVerification("FF09"+Constants.COMMAND_ADDRESS_HEIGHT+"D1"+Constants.COMMAND_DOOR_STATUS_CLOSE+"00")+"FE";
	}
	
	// 读光栅1状态命令 
	public static String sendCommandReadLightOne() {
		return CRC16.hexVerification("FF08"+Constants.COMMAND_ADDRESS_HEIGHT+"D7A0")+"FE";
	}
	
	// 读光栅2状态命令 
	public static String sendCommandReadLightTwo() {
		return CRC16.hexVerification("FF08"+Constants.COMMAND_ADDRESS_HEIGHT+"D7A1")+"FE";
	}
}
